﻿//图层管理注册通用方法
//#region 获取数据资源目录节点信息
function GetLayerTreeNode(lyInfo) {
    treeNode = {
        level: 0,
        isCatalog: true,
        mainDiv: {//总体DIV容器
            class: "LayerTree-main-form-item",
            pname: ""
        },
        contentDiv: {//图标及提示信息
            class: "LayerTree-main-form-item-title", //div
            arrowClass: "arrow", //i
            iconClass: "", //i
            checkClass: "checkicon", //i
            textClass: "LayerTree-main-form-item-content", //span
            text: "",
            alias: "",
            guid:""
        }
    };
    if (lyInfo) {
        if (lyInfo["NAME"].toString() != "") {//图层
            treeNode.isCatalog = false;
            treeNode.contentDiv.iconClass = "typeicon iconlocal";
            treeNode.contentDiv.text = lyInfo["NAME"];
            treeNode.contentDiv.alias = lyInfo["ALIAS"];
            treeNode.contentDiv.guid= lyInfo["GUID"];
        }
        else {//图层组
            //treeNode.mainDiv.class = "LayerTree-main-form-item active";
            treeNode.contentDiv.iconClass = "typeicon iconmodel";
        }
        if (lyInfo["ATTR_D"].toString() != "") {
            if (lyInfo["NAME"].toString() == "") {//D级目录
                treeNode.level = 3;
                treeNode.mainDiv.pname = lyInfo["ATTR_C"];
                treeNode.contentDiv.text = lyInfo["ATTR_D"];
                treeNode.contentDiv.alias = lyInfo["ATTR_D"];
            }
            else {//D级子级叶子节点
                treeNode.level = 4;
                treeNode.mainDiv.pname = lyInfo["ATTR_D"];
            }
        }
        else if (lyInfo["ATTR_D"].toString() == "" && lyInfo["ATTR_C"].toString() != "") {
            if (lyInfo["NAME"].toString() == "") {//C级目录
                treeNode.level = 2;
                treeNode.mainDiv.pname = lyInfo["ATTR_B"];
                treeNode.contentDiv.text = lyInfo["ATTR_C"];
                treeNode.contentDiv.alias = lyInfo["ATTR_C"];
            } else {
                treeNode.level = 3;
                treeNode.mainDiv.pname = lyInfo["ATTR_C"];
            }
        }
        else if (lyInfo["ATTR_C"].toString() == "" && lyInfo["ATTR_B"].toString() != "") {
            if (lyInfo["NAME"].toString() == "") {//B级目录
                treeNode.level = 1;
                treeNode.mainDiv.pname = lyInfo["ATTR_A"];
                treeNode.contentDiv.text = lyInfo["ATTR_B"];
                treeNode.contentDiv.alias = lyInfo["ATTR_B"];
            }
            else {
                treeNode.level = 2;
                treeNode.mainDiv.pname = lyInfo["ATTR_B"];
            }
        }
        else if (lyInfo["ATTR_B"].toString() == "" && lyInfo["ATTR_A"].toString() != "") {
            if (treeNode.isCatalog) {
                treeNode.level = 0;
                treeNode.mainDiv.pname = "root";
                treeNode.contentDiv.text = lyInfo["ATTR_A"];
                treeNode.contentDiv.alias = lyInfo["ATTR_A"];
            }
            else {
                treeNode.level = 1;
                treeNode.mainDiv.pname = lyInfo["ATTR_A"];
            }
        }
    }
    return treeNode;
}

//#endregion

//#region 其他设置

//#endregion
